package com.xb.sourest.utils;

import android.content.Context;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

public class AssentsHelper {

    /**
     * 读取公钥
     * @param context
     * @return
     */
    public synchronized  static String readCerts(Context context)  {
        if (context ==null) return null;
        try {
            InputStream inputStream = context.getResources().getAssets().open("cert.properties");
            InputStreamReader isr =new InputStreamReader(inputStream, "GBK");//将字节流包装成字符流
            BufferedReader br=new BufferedReader(isr);//设置缓冲区
            String str="";
            while((str=br.readLine()) != null){//如果这行的数据不为空就读取数据
                str += br.readLine();
            }
            return str;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
